ace.define("ace/mode/lua",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/lua_highlight_rules","ace/mode/folding/lua","ace/range","ace/worker/worker_client"],function(e,t,n){var r=e("../lib/oop"),o=e("./text").Mode,i=e("./lua_highlight_rules").LuaHighlightRules,a=e("./folding/lua").FoldMode,l=e("../range").Range,s=e("../worker/worker_client").WorkerClient,g=function(){this.HighlightRules=i,this.foldingRules=new a};r.inherits(g,o),function(){function e(e){for(var n=0,r=0;r<e.length;r++){var o=e[r];"keyword"==o.type?o.value in t&&(n+=t[o.value]):"paren.lparen"==o.type?n++:"paren.rparen"==o.type&&n--}return 0>n?-1:n>0?1:0}this.lineCommentStart="--",this.blockComment={start:"--[",end:"]--"};var t={"function":1,then:1,"do":1,"else":1,elseif:1,repeat:1,end:-1,until:-1},n=["else","elseif","end","until"];this.getNextLineIndent=function(t,n,r){var o=this.$getIndent(n),i=0,a=this.getTokenizer().getLineTokens(n,t),l=a.tokens;return"start"==t&&(i=e(l)),i>0?o+r:0>i&&o.substr(o.length-r.length)==r&&!this.checkOutdent(t,n,"\n")?o.substr(0,o.length-r.length):o},this.checkOutdent=function(e,t,r){if("\n"!=r&&"\r"!=r&&"\r\n"!=r)return!1;if(t.match(/^\s*[\)\}\]]$/))return!0;var o=this.getTokenizer().getLineTokens(t.trim(),e).tokens;return o&&o.length?"keyword"==o[0].type&&-1!=n.indexOf(o[0].value):!1},this.autoOutdent=function(t,n,r){var o=n.getLine(r-1),i=this.$getIndent(o).length,a=this.getTokenizer().getLineTokens(o,"start").tokens,s=n.getTabString().length,g=i+s*e(a),d=this.$getIndent(n.getLine(r)).length;g>d||n.outdentRows(new l(r,0,r+2,0))},this.createWorker=function(e){var t=new s(["ace"],"ace/mode/lua_worker","Worker");return t.attachToDocument(e.getDocument()),t.on("error",function(t){e.setAnnotations([t.data])}),t.on("ok",function(t){e.clearAnnotations()}),t},this.$id="ace/mode/lua"}.call(g.prototype),t.Mode=g}),ace.define("ace/mode/lua_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),o=e("./text_highlight_rules").TextHighlightRules,i=function(){var e="break|do|else|elseif|end|for|function|if|in|local|repeat|return|then|until|while|or|and|not",t="true|false|nil|_G|_VERSION",n="string|xpcall|package|tostring|print|os|unpack|require|getfenv|setmetatable|next|assert|tonumber|io|rawequal|collectgarbage|getmetatable|module|rawset|math|debug|pcall|table|newproxy|type|coroutine|_G|select|gcinfo|pairs|rawget|loadstring|ipairs|_VERSION|dofile|setfenv|load|error|loadfile|sub|upper|len|gfind|rep|find|match|char|dump|gmatch|reverse|byte|format|gsub|lower|preload|loadlib|loaded|loaders|cpath|config|path|seeall|exit|setlocale|date|getenv|difftime|remove|time|clock|tmpname|rename|execute|lines|write|close|flush|open|output|type|read|stderr|stdin|input|stdout|popen|tmpfile|log|max|acos|huge|ldexp|pi|cos|tanh|pow|deg|tan|cosh|sinh|random|randomseed|frexp|ceil|floor|rad|abs|sqrt|modf|asin|min|mod|fmod|log10|atan2|exp|sin|atan|getupvalue|debug|sethook|getmetatable|gethook|setmetatable|setlocal|traceback|setfenv|getinfo|setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|foreachi|maxn|foreach|concat|sort|remove|resume|yield|status|wrap|create|running|__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber",r="string|package|os|io|math|debug|table|coroutine",o="",i="setn|foreach|foreachi|gcinfo|log10|maxn",a=this.createKeywordMapper({keyword:e,"support.function":n,"invalid.deprecated":i,"constant.library":r,"constant.language":t,"invalid.illegal":o,"variable.language":"self"},"identifier"),l="(?:(?:[1-9]\\d*)|(?:0))",s="(?:0[xX][\\dA-Fa-f]+)",g="(?:"+l+"|"+s+")",d="(?:\\.\\d+)",u="(?:\\d+)",c="(?:(?:"+u+"?"+d+")|(?:"+u+"\\.))",h="(?:"+c+")";this.$rules={start:[{stateName:"bracketedComment",onMatch:function(e,t,n){return n.unshift(this.next,e.length-2,t),"comment"},regex:/\-\-\[=*\[/,next:[{onMatch:function(e,t,n){return e.length==n[1]?(n.shift(),n.shift(),this.next=n.shift()):this.next="","comment"},regex:/\]=*\]/,next:"start"},{defaultToken:"comment"}]},{token:"comment",regex:"\\-\\-.*$"},{stateName:"bracketedString",onMatch:function(e,t,n){return n.unshift(this.next,e.length,t),"comment"},regex:/\[=*\[/,next:[{onMatch:function(e,t,n){return e.length==n[1]?(n.shift(),n.shift(),this.next=n.shift()):this.next="","comment"},regex:/\]=*\]/,next:"start"},{defaultToken:"comment"}]},{token:"string",regex:'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:h},{token:"constant.numeric",regex:g+"\\b"},{token:a,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\/|%|\\#|\\^|~|<|>|<=|=>|==|~=|=|\\:|\\.\\.\\.|\\.\\."},{token:"paren.lparen",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+|\\w+"}]},this.normalizeRules()};r.inherits(i,o),t.LuaHighlightRules=i}),ace.define("ace/mode/folding/lua",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"],function(e,t,n){var r=e("../../lib/oop"),o=e("./fold_mode").FoldMode,i=e("../../range").Range,a=e("../../token_iterator").TokenIterator,l=t.FoldMode=function(){};r.inherits(l,o),function(){this.foldingStartMarker=/\b(function|then|do|repeat)\b|{\s*$|(\[=*\[)/,this.foldingStopMarker=/\bend\b|^\s*}|\]=*\]/,this.getFoldWidget=function(e,t,n){var r=e.getLine(n),o=this.foldingStartMarker.test(r),i=this.foldingStopMarker.test(r);if(o&&!i){var a=r.match(this.foldingStartMarker);if("then"==a[1]&&/\belseif\b/.test(r))return;if(a[1]){if("keyword"===e.getTokenAt(n,a.index+1).type)return"start"}else{if(!a[2])return"start";var l=e.bgTokenizer.getState(n)||"";if("bracketedComment"==l[0]||"bracketedString"==l[0])return"start"}}if("markbeginend"!=t||!i||o&&i)return"";var a=r.match(this.foldingStopMarker);if("end"===a[0]){if("keyword"===e.getTokenAt(n,a.index+1).type)return"end"}else{if("]"!==a[0][0])return"end";var l=e.bgTokenizer.getState(n-1)||"";if("bracketedComment"==l[0]||"bracketedString"==l[0])return"end"}},this.getFoldWidgetRange=function(e,t,n){var r=e.doc.getLine(n),o=this.foldingStartMarker.exec(r);if(o)return o[1]?this.luaBlock(e,n,o.index+1):o[2]?e.getCommentFoldRange(n,o.index+1):this.openingBracketBlock(e,"{",n,o.index);var o=this.foldingStopMarker.exec(r);return o?"end"===o[0]&&"keyword"===e.getTokenAt(n,o.index+1).type?this.luaBlock(e,n,o.index+1):"]"===o[0][0]?e.getCommentFoldRange(n,o.index+1):this.closingBracketBlock(e,"}",n,o.index+o[0].length):void 0},this.luaBlock=function(e,t,n){var r=new a(e,t,n),o={"function":1,"do":1,then:1,elseif:-1,end:-1,repeat:1,until:-1},l=r.getCurrentToken();if(l&&"keyword"==l.type){var s=l.value,g=[s],d=o[s];if(d){var u=-1===d?r.getCurrentTokenColumn():e.getLine(t).length,c=t;for(r.step=-1===d?r.stepBackward:r.stepForward;l=r.step();)if("keyword"===l.type){var h=d*o[l.value];if(h>0)g.unshift(l.value);else if(0>=h){if(g.shift(),!g.length&&"elseif"!=l.value)break;0===h&&g.unshift(l.value)}}var t=r.getCurrentTokenRow();return-1===d?new i(t,e.getLine(t).length,c,u):new i(c,u,t,r.getCurrentTokenColumn())}}}}.call(l.prototype)});